﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Text;

public partial class topic_topic_d : Basic
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }

    private Topics2 tt;
    public Topics2 TT
    {
        get
        {
            if (tt != null)
            {
                return tt;
            }
            string str = Pub.LoadData(jsonUrl + "/topic/Topic.ashx?id=" + Request["id"]);
            tt = Newtonsoft.Json.JsonConvert.DeserializeObject<Topics2>(str);
            return tt;
        }
    }

    /// <summary>
    /// 第一排内容
    /// </summary>
    public string C1
    {
        get
        {
            System.Text.StringBuilder s = new System.Text.StringBuilder();
            for (int i = 0; i < TT.H1.Count; i++)
            {
                var c = TT.H1[i];
                s.AppendLine("<li>");
                s.AppendLine("    <div class=\"rdzt_img\"><a href=\"" + GetNewsUrl("05", "0", c.Id) + "\" class=\"b\"><img style=\"border:0px\" width=\"79\" height=\"71\" src=\"images" + c.ImgUrl + "\" alt=\"标题图片\" /></a></div>");
                s.AppendLine("    <div class=\"rdzt_intro\"><span class=\"h3\"><a href=\"" + GetNewsUrl("05","0",c.Id) + "\" class=\"b\">" + c.Title + "</a></span><br />");
                s.AppendLine(c.Summary + "<a href=\"" + GetNewsUrl("05","0" , c.Id) + "\" class=\"b\">[详情]</a></div>");
                s.AppendLine("</li>");
            }
            return s.ToString();
        }
    }

    public string C21
    {
        get
        {
            System.Text.StringBuilder s = new System.Text.StringBuilder();
            for (int i = 0; i < TT.H21.Count; i++)
            {
                var c = TT.H21[i];
                s.AppendLine("<li>");
                s.AppendLine("   <div class=\"rdzt_img\"><a href=\"" + GetNewsUrl("05", "0", c.Id) + "\" class=\"b\"><img style=\"border:0px\" width=\"79\" height=\"71\" src=\"images" + c.ImgUrl + "\" alt=\"标题图片\" /></a></div>");
                s.AppendLine("   <div class=\"rdzt_intro1\"><span class=\"h3\"><a href=\"" + GetNewsUrl("05","0", c.Id) + "\" class=\"b\">" + c.Title + "</a></span><br />");
                s.AppendLine(c.Summary+ "<a href=\""+GetNewsUrl("05","0", c.Id)+"\" class=\"b\">[详情]</a></div>");
                s.AppendLine("</li>");
                s.AppendLine("<div class=\"clearok\"></div>");
                s.AppendLine("<li class=\"line\"></li>");
            }
            return s.ToString();
        }
    }

    public string C22
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H22.Count; i++)
            {
                s.AppendLine("<li>·<a href=\"" +GetNewsUrl("05","0", tt.H22[i].Id)+"\">" + tt.H22[i].Title + "</a></li>");
            }
            return s.ToString();
        }
    }

    public string C23
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H23.Count; i++)
            {
                s.AppendLine("<li> <span class=\"font-weight\"><a href=\"" + GetNewsUrl("05","0", TT.H23[i].Id) + "\" class=\"b\">" + tt.H23[i].Title + "</a></span><br />");
                s.AppendLine(tt.H23[i].Summary + "<a href=\""+ GetNewsUrl("05","0", TT.H23[i].Id) + "\" class=\"b\">[详情]</a> </li>");
                s.AppendLine("   <div class=\"clearok\"></div>");
                s.AppendLine("<li class=\"line\"></li>");
            }
            return s.ToString();
        }
    }

    public string C31
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H31.Count; i++)
            {
                s.AppendLine("<li>");
                s.AppendLine("   <div class=\"rdzt_img\"><a href=\"" + GetNewsUrl("05", "0", TT.H31[i].Id) + "\" class=\"b\"><img style=\"border:0px\" width=\"79\" height=\"71\" src=\"images" + TT.H31[i].ImgUrl + "\" alt=\"标题图片\" /></a></div>");
                s.AppendLine("   <div class=\"rdzt_intro1\"><span class=\"h3\"><a href=\"" + GetNewsUrl("05", "0", TT.H31[i].Id) + "\" class=\"b\">" + tt.H31[i].Title + "</a></span><br />");
                s.AppendLine(tt.H31[i].Summary + "<a href=\"" + GetNewsUrl("05", "0", TT.H31[i].Id) + "\" class=\"b\">[详情]</a></div>");
                s.AppendLine("</li>");
                s.AppendLine("<div class=\"clearok\"></div>");
                s.AppendLine("<li class=\"line\"></li>");
            }
            return s.ToString();
        }
    }

    public string C32
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H32.Count; i++)
            {
                s.AppendLine("<li> <span class=\"h3\">"+TT.H32[i].Title+"</span><br />");
                s.AppendLine(TT.H32[i].Summary+ "</li>");
                s.AppendLine(" <div class=\"clearok\"></div>");
                s.AppendLine(" <li class=\"line\"></li>");
            }
            return s.ToString();
        }
    }

    public string C41
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H4.Count; i++)
            {
                string summary = TT.H4[i].Summary;
                if (summary.Length > 64)
                {
                    summary = summary.Substring(0, 64) + "…";
                }
                string cl = "h3";
                if (i % 3 == 2)
                {
                    cl = "right";
                }
                s.AppendLine("<li class=\"right\"><span class=\"h3\"><a href=\"" + GetNewsUrl("05", "0", TT.H4[i].Id) + "\" class=\"b\">" + TT.H4[i].Title + "</a></span><br />");
                s.AppendLine("<div class=\"rdzt_img\"><a href=\"" + GetNewsUrl("05", "0", TT.H4[i].Id) + "\" class=\"b\"><img style=\"border:0px\" width=\"79\" height=\"71\" src=\"images" + TT.H4[i].ImgUrl + "\" alt=\"标题图片\" /></a></div>");
                s.AppendLine("<div class=\"rdzt_intro2\">"+summary+"</div>");
                s.AppendLine("</li>");
            }
            return s.ToString();
        }
    }

    public string C71
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H71.Count; i++)
            {
                s.AppendLine("<li>·<a href=\"" + GetNewsUrl( "05","0", TT.H71[i].Id) + "\">" + TT.H71[i].Title + "</a></li>");
            }
            return s.ToString();
        }
    }

    public string C72
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H72.Count; i++)
            {
                s.AppendLine(" <li>·<a href=\"" +GetNewsUrl("05","0", TT.H72[i].Id) + "\">" + TT.H72[i].Title + "</a></li>");
            }
            return s.ToString();
        }
    }


    /// <summary>
    /// 大图
    /// </summary>
    public string C5_Big
    {
        get
        {
            StringBuilder s = new StringBuilder();
            if (TT.H5.Where(x => x.IsBigImg == true).Count() == 0)
            {
                return string.Empty;
            }
            s.AppendLine("<div class=\"banner_li\">");
            for (int i = 0; i < TT.H5.Count; i++)
            {
                if (TT.H5[i].IsBigImg == true)
                {
                    s.AppendLine("<img style=\"border:0px\" width=\"958\" heigth=\"176\"  src=\"images" + TT.H5[i].Path + "\" />");
                }
            }
            s.AppendLine("</div>");
            return s.ToString();
        }
    }

    public string C5_Small
    {
        get
        {
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < TT.H5.Count; i++)
            {
                if (TT.H5[i].IsBigImg != true)
                {
                    s.AppendLine("<li class=\"right\"><img style=\"border:0px\" src=\"images/ico_arrow3.jpg\" />&nbsp;<span class=\"font14 font-weight\">" + TT.H5[i].Title + "</span><br />");
                    s.AppendLine("<img style=\"border:0px\" width=\"413\" heigth=\"216\" src=\"images" + TT.H5[i].Path + "\" alt=\"图表\" /></li>");
                }
            }
            return s.ToString();
        }
    }

    public string FirstTitle
    {
        get
        {
            if (TT.FirstNews == null)
            {
                return string.Empty;
            }
            else
            {
                return TT.FirstNews.Title;
            }
        }
    }

    public string FirstSummary
    {
        get
        {
            if (TT.FirstNews == null)
            {
                return string.Empty;
            }
            else
            {
                return TT.FirstNews.Summary;
            }
        }
    }

    public string FirstUrl
    {
        get
        {
            if (TT.FirstNews == null)
            {
                return string.Empty;
            }
            else
            {
                return GetNewsUrl("05","0", TT.FirstNews.Id);
            }
        }
    }

    public string Str_Vote
    {
        get
        {
            StringBuilder s = new StringBuilder();
            string str = Pub.LoadData(jsonUrl + "topic/TopicVoteList.ashx?typeid=" + TT.VoteTypeId);
            var c = Newtonsoft.Json.JsonConvert.DeserializeObject<Topic2Vote>(str);
            s.AppendLine("<div class=\"rdzt_title\"><img style=\"border:0px\" src=\"images/ico_arrow2.jpg\" hspace=\"10\" />" + c.Title + "</div>");
            s.AppendLine("<div class=\"clearok\"></div>");
            s.AppendLine(" <div class=\"invest_c\">");
            s.AppendLine(" <ul>");
            s.AppendLine(" <li>" + c.Question + "</li>");
            for (int i = 0; i < c.lst.Count; i++)
            {
                s.AppendLine(" <li>");
                s.AppendLine(" <input type=\"radio\" name=\"radio\" id=\"radio\" value=\""+c.lst[i].id+"\" />");
                s.AppendLine(c.lst[i].Title+ " </li>");
            }
            s.AppendLine("<li class=\"marginTop5\"><img style=\"border:0px\" src=\"images/btn_vote.jpg\" id='imgVote' />&nbsp;<img style=\"border:0px\" src=\"images/btn_check.jpg\" id=\"btnRedirectToupiao\" tid=\"" + TT.VoteTypeId + "\" /></li>");
            s.AppendLine(" </ul>");
            s.AppendLine(" </div>");
            return s.ToString();
        }
    }


}